package day021.tcp.demo7;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.beans.beancontext.BeanContextServicesSupport;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class TcpServer {
    private static final Logger LOGGER= LoggerFactory.getLogger("TcpServer服务端");

    public static void main(String[] args) throws IOException {
        ExecutorService es= Executors.newFixedThreadPool(10);

        ServerSocket ss=new ServerSocket(9090);
        LOGGER.trace("服务端已启动...");
        while(true){
            Socket server=ss.accept();
            LOGGER.trace(server.getInetAddress().getHostName()+"已连接");

            es.submit(new UploadTask(server,LOGGER));
        }
    }
}
